﻿using System;
using System.Windows.Forms;
using TED;

namespace TEDTalksDownloadManager
{
  
    public partial class frmConverter : Form
    {
        #region # Constructor #
        public frmConverter()
        {
            InitializeComponent();
            converter = new MetalinkConverter();
        }
        #endregion

        #region - Private variables -
        MetalinkConverter converter;
        #endregion
     
        //#region - Public properties / variables - 
        //#endregion

        //#region - Public methods - 
        //#endregion

        #region - Bind Methods -
        #endregion

        #region - Form Events -
        #endregion

        #region - Control Methods -
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(txtFileName.Text))
            {
                converter.ConvertMetaDataFile(txtFileName.Text, String.IsNullOrEmpty(txtOutputPath.Text) ? @".\" : txtOutputPath.Text);
                this.DialogResult = DialogResult.OK;
            }
        }
        private void btnGetFileName_Click(object sender, EventArgs e)
        {
            OpenFileDialog opf = new OpenFileDialog();
            opf.Filter = "Metalink File|*.metalink";
            if (opf.ShowDialog() == DialogResult.OK)
            {
                txtFileName.Text = opf.FileName;
            }
        }
        private void btnOutputPath_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog fbd = new FolderBrowserDialog();
            if (fbd.ShowDialog() == DialogResult.Yes)
            {
                txtOutputPath.Text = fbd.SelectedPath;
            }
        }
        #endregion



    }
}
